clear
* Change the rows below to the directories you use *
cd "C:\Users\nikljako\Box\Bedrägerier\Output"
import excel "C:\Users\nikljako\Box\Bedrägerier\Data\week_panel.xlsx", sheet("Sheet1") firstrow

* Rename and label variables *
rename Brottsdatum date
label variable date "Date at start of week"
label variable tot_full "Weekly plantiffs all ages"
label variable small_full "Weekly plantiffs, most relevant codes"
label variable tot_five "Weekly plantiffs, 65-74"
label variable small_five "Weekly plantiffs, most relevant codes, 65-74"
label variable tot_doughnut "Weekly plantiffs, 65-67 and 72-74"
label variable small_doughnut "Weekly plantiffs, most relevant codes, 65-67 and 72-74"
label variable tot_five_doughnut "Weekly plantiffs, 61-65 and 74-78"
label variable small_five_doughnut "Weekly plantiffs, most relevant codes, 61-65 and 74-78"
label variable treated "70 or over"
label variable after "Week 8 or after"
label variable after10 "After week 10"

* Generate additional variables *
gen ln_small_five = ln(small_five) 
gen inter = treated * after

xtset treated running

* Table 1 (presented in the paper) *
reg small_five treated after inter i.week i.month i.year, robust
outreg2 using table1, word replace bdec(3)
reg small_doughnut treated inter after i.week i.month i.year, robust
outreg2 using table1, word append bdec(3)

* Below are some additional estimations, only mentioned in the paper, in most cases we find no treatemnt effects *

* Negative binomial
nbreg small_five treated after inter i.week i.month i.year, robust
* Natural log
reg ln_small_five treated after inter i.week i.month i.year, robust
* Delayed treatment two weeks
gen inter10 = treated * after10
reg small_five treated after10 inter10 i.week i.month i.year, robust
* All ages
reg small_full treated after inter i.week i.month i.year, robust
* Broader set of crime codes
reg tot_five treated after inter i.week i.month i.year, robust
* Shorter before period
drop if running < -23
reg small_five treated after inter i.week i.month i.year, robust
* Different lags
newey small_five treated after inter i.week i.month i.year, lag(3) force
newey small_five treated after inter i.week i.month i.year, lag(1) force
newey small_five treated after inter i.week i.month i.year, lag(10) force
newey small_five treated after inter i.week i.month i.year, lag(15) force